import Main from '@/layout/Main';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
  path: '/login',
  name: 'login',
  meta: {
    title: '基础模版平台 - 登录'
  },
  component: resolve => {
    require(['@/routes/login1.vue'], resolve);
  }
};

export const page404 = {
  path: '/*',
  name: 'error_404',
  meta: {
      title: '404-页面不存在'
  },
  component: resolve => { require(['@/routes/error_page/404.vue'], resolve); }
};

export const page401 = {
  path: '/401',
  meta: {
      title: '401-权限不足'
  },
  name: 'error_401',
  component: resolve => { require(['@/routes/error_page/401.vue'], resolve); }
};

export const page500 = {
  path: '/500',
  meta: {
      title: '500-服务端错误'
  },
  name: 'error_500',
  component: resolve => { require(['@/routes/error_page/500.vue'], resolve); }
};

export const locking = {
  path: '/locking',
  name: 'locking',
  component: resolve => { require(['@/components/main/lock-screen/locking-page.vue'], resolve); }
};


// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
  path: '/',
  name: 'otherRouter',
  redirect: '/home',
  component: Main,
  children: [
    { path: 'home',  name: 'home_index', title:'首页', component: resolve => { require(['@/routes/home'], resolve); }},
    { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/routes/own-space/own-space.vue'], resolve); } },
    { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['@/routes/message'], resolve); } },
    { path: 'opinion_feedback',  name: 'opinion_feedback', title:'意见反馈', component: resolve => { require(['@/routes/opinion'], resolve); }},
    { path: 'change_log',  name: 'change_log', title:'更新日志', component: resolve => { require(['@/routes/change_log'], resolve); }},
    { path: 'order/:order_id', title: '订单详情', name: 'order_info', component: resolve => { require(['@/routes/advanced-router/component/order-info.vue'], resolve); } },  // 用于展示动态路由
    { path: 'shopping', title: '购物详情', name: 'shopping', component: resolve => { require(['@/routes/advanced-router/component/shopping-info.vue'], resolve); } },  // 用于展示带参路由
    { path: 'article_issue', title: '编辑/发布', name: 'article_issue', component: resolve => { require(['@/routes/blog/article/component/issue'], resolve); } },  // 用于展示带参路由
  ]
}

export const appRouter = [{
    path: '/dashboard',
    icon: 'ios-speedometer-outline',
    name: 'dashboard',
    title: 'Dashboard',
    component: Main,
    children: [
      { path: 'article-list', meta:{access:1},title: '分析页', name: 'article-list', icon: 'compose', component: resolve => { require(['@/routes/blog/article'], resolve); } },
      { path: 'article-type',meta:{access:1}, title: '监控页', name: 'article-type', icon: 'arrow-swap', component: resolve => { require(['@/routes/form/work-flow/work-flow.vue'], resolve); } },
      { path: 'article-type',meta:{access:1}, title: '工作台', name: 'article-type', icon: 'arrow-swap', component: resolve => { require(['@/routes/form/work-flow/work-flow.vue'], resolve); } },
    ]
  },{
    path: '/blog',
    icon: 'ios-paper-outline',
    name: 'blog',
    title: '博客管理',
    component: Main,
    children: [
      { path: 'article-list', meta:{access:1},title: '文章列表', name: 'article-list', icon: 'compose', component: resolve => { require(['@/routes/blog/article'], resolve); } },
      { path: 'article-type',meta:{access:1}, title: '文章分类', name: 'article-type', icon: 'arrow-swap', component: resolve => { require(['@/routes/form/work-flow/work-flow.vue'], resolve); } }

    ]
    },{
      path: '/admin',
      icon: 'gear-a',
      name: 'admin',
      title: '系统管理',
      access: 1,
      component: Main,
      children: [
        { path: 'role',meta:{access:1},icon: 'ios-toggle-outline',name: 'role',title: '角色管理',component: resolve => {require(['@/routes/admin/role'], resolve);}},
        { path: 'organ',meta:{access:1},icon: 'social-buffer-outline',name: 'organ',title: '组织管理',component: resolve => {require(['@/routes/admin/organ'], resolve);}},
        { path: 'resource',meta:{access:1},icon: 'drag',name: 'resource', title: '资源管理',component: resolve => {require(['@/routes/admin/resource'], resolve);}},
        { path: 'permission',meta:{access:1},icon: 'drag',name: 'permission', title: '权限管理',component: resolve => {require(['@/routes/admin/permission'], resolve);}},
        { path: 'user',meta:{access:1},icon: 'ios-people-outline',name: 'user',title: '用户管理',component: resolve => {require(['@/routes/admin/user'], resolve);}},
        { path: 'session',meta:{access:1},icon: 'ios-chatbubble-outline',name: 'session',title: '会话管理',component: resolve => {require(['@/routes/admin/session'], resolve);}},
        { path: 'dic',meta:{access:1},icon: 'android-clipboard',name: 'dic',title: '数据字典',component: resolve => {require(['@/routes/admin/dic'], resolve);}},
        { path: 'cache',meta:{access:1},icon: 'ios-crop-strong',name: 'cache',title: '缓存管理',component: resolve => {require(['@/routes/admin/cache'], resolve);}},
        { path: 'event', meta:{access:1}, icon: 'ios-paper-outline', name: 'event', title: '业务日志', component: resolve => { require(['@/routes/admin/event'], resolve);}},
        { path: 'sysLog',meta:{access:1}, icon: 'ios-paper-outline', name: 'sysLog', title: '系统日志', component: resolve => { require(['@/routes/admin/sysLog'], resolve);}},
        { path: 'errorInfo', meta:{access:1}, icon: 'ios-trash-outline',name: 'errorInfo',title: '错误信息',component: resolve => {require(['@/routes/admin/error'], resolve);}},
        { path: 'modifyInfo', meta:{access:1},icon: 'ios-compose-outline',name: 'modifyInfo',title: '修改信息',component: resolve => {require(['@/routes/admin/modify'], resolve);}},
        { path: 'opinion',meta:{access:1},icon: 'chatbubble-working',name: 'opinion',title: '意见反馈',component: resolve => {require(['@/routes/admin/opinion'], resolve);}},
        { path: 'file',meta:{access:1},icon: 'ios-folder',name: 'file',title: '附件管理',component: resolve => {require(['@/routes/admin/opinion'], resolve);}},
      ]
    },{
      path: '/component',
      icon: 'social-buffer',
      name: 'component',
      title: '组件',
      component: Main,
      children: [
          {
              path: 'text-editor',
              icon: 'compose',
              name: 'text-editor',
              title: '富文本编辑器',
              component: resolve => { require(['@/routes/my_components/text-editor/text-editor.vue'], resolve); }
          },
          {
              path: 'md-editor',
              icon: 'pound',
              name: 'md-editor',
              title: 'MK编辑器',
              component: resolve => { require(['@/routes/my_components/markdown-editor/markdown-editor.vue'], resolve); }
          },
          {
              path: 'area-linkage',
              icon: 'ios-more',
              name: 'area-linkage',
              title: '城市级联',
              component: resolve => { require(['@/routes/my_components/area-linkage/area-linkage.vue'], resolve); }
          },
          {
              path: 'file-upload',
              icon: 'android-upload',
              name: 'file-upload',
              title: '文件上传',
              component: resolve => { require(['@/routes/my_components/file-upload/file-upload.vue'], resolve); }
          },
          {
              path: 'count-to',
              icon: 'arrow-graph-up-right',
              name: 'count-to',
              title: '数字渐变',
              component: resolve => { require(['@/routes/my_components/count-to/count-to.vue'], resolve); }
          },
          {
              path: 'pdf-preview',
              icon: 'arrow-graph-up-right',
              name: 'pdf-preview',
              title: 'PDF预览',
              component: resolve => { require(['@/routes/my_components/pdf-preview/pdf-preview.vue'], resolve); }
          },
          {
              path: 'video',
              icon: 'arrow-graph-up-right',
              name: 'video',
              title: '视频预览',
              component: resolve => { require(['@/routes/my_components/video'], resolve); }
          },
          {
              path: 'baidu-map',
              icon: 'arrow-graph-up-right',
              name: 'baidu-map',
              title: '百度地图',
              component: resolve => { require(['@/routes/my_components/baidu-map'], resolve); }
          }
      ]
    },{
      path: '/form',
      icon: 'android-checkbox',
      name: 'form',
      title: '表单编辑',
      component: Main,
      children: [
          { path: 'artical-publish', title: '文章发布', name: 'artical-publish', icon: 'compose', component: resolve => { require(['@/routes/form/article-publish/article-publish.vue'], resolve); } },
          { path: 'workflow', title: '工作流', name: 'workflow', icon: 'arrow-swap', component: resolve => { require(['@/routes/form/work-flow/work-flow.vue'], resolve); } },
          { path: 'step-form', title: '分步表单', name: 'step-form', icon: 'arrow-swap', component: resolve => { require(['@/routes/form/step-form'], resolve); } },
          { path: 'advanced-form', title: '高级表单', name: 'advanced-form', icon: 'arrow-swap', component: resolve => { require(['@/routes/form/advanced-form'], resolve); } },
      ]
    },{
      path: '/advanced-router',
      icon: 'ios-infinite',
      name: 'advanced-router',
      title: '高级路由',
      component: Main,
      children: [
          { path: 'mutative-router', title: '动态路由', name: 'mutative-router', icon: 'link', component: resolve => { require(['@/routes/advanced-router/mutative-router.vue'], resolve); } },
          { path: 'argument-page', title: '带参页面', name: 'argument-page', icon: 'android-send', component: resolve => { require(['@/routes/advanced-router/argument-page.vue'], resolve); } }
      ]
    },{
      path: '/error-page',
      icon: 'android-sad',
      title: '错误页面',
      name: 'errorpage',
      component: Main,
      children: [
          { path: 'index', title: '错误页面', name: 'errorpage_index', component: resolve => { require(['@/routes/error_page/error-page.vue'], resolve); } }
      ]
    }]


export const routers = [
  loginRouter,
  otherRouter,
  ...appRouter,
  locking,
  page401,
  page500,
  page404,
];
